package pro.cherish.knowledgeumldesignpattern.designPattern.com.cherish.observer.jdk;

import java.util.Observable;
import java.util.Observer;
//目标对象
public class ConcreteSubject extends Observable {
    private int state;

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public void set(int s){
//        目标对象状态发生改变
        state=s;
//        表示目标对象已经更改
        setChanged();
//        通知所有的观察者
        notifyObservers(state);
    }

}
